home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
c4
/
pro2
/
1n06046b
< prev
next >
Wrap
Text File
|
1990-10-01
|
548b
|
22 lines
Listing 3: the C program
/* program to return random value */
/* random(n,0) returns next random value in sequence */
/* random(n,s) resets random sequence with new seed s */
pascal random (int size, int seed)
{
int i; /* define space for integer */
if (seed != 0) srand(seed); /* if seed not equal to 0 then restart */
/* pseudo random sequence */
return(rand() % size); /* return random number within range of size */
}